function checkEmail(email){
	var reg = /^\w+@\w+(\.[a-zA-Z]{2,3})+$/;
	if(email==""){
		codeEmail = false;
		$("#TANGRAM__4__emailError").text("请填写邮箱");
		$("#TANGRAM__4__email").css("border-color","#DB1111 #D91111 #D91111");
	}
	if(!reg.test(email)){
		codeEmail = false;
		$("#TANGRAM__4__emailError").text("邮箱格式不正确");
		$("#TANGRAM__4__email").css("border-color","#DB1111 #D91111 #D91111");
	}
	else{
		//检查邮箱的唯一性
		$.ajax({
			url:contextPath+"/checkEmail.action",
			async:false,
			type:"post",
			dataType:"json",
			data:{
				"email":email,
				"method:queryEmail":"ok"
			},
			success:function(data){
				var success = data.success;
				$("#TANGRAM__4__emailError").text("");
				if(success==true) {
					codeEmail = true;
					$("#TANGRAM__4__emailSucc").css("display","block");
					$("#TANGRAM__4__email").css("border-color","#CCCCCC #DDDDDD #DDDDDD #CCCCCC");
				}else{
					codeEmail = false;
					$("#TANGRAM__4__emailError").html("邮箱已经被使用,请直接<a href='${ctx}/login.jsp'>登录</a>");
					$("#TANGRAM__4__email").css("border-color","#DB1111 #D91111 #D91111");
				}
			},
			error: function(){alert("出现错误了！"); },
			complete : function(){ 
			}
		});
	}
}
function checkPassword(password){
	var length = password.length;
	if(length==0){
		codeEmail = false;
		$("#TANGRAM__4__passwordError").html("请填写密码");
		$("#TANGRAM__4__password").css("border-color","#DB1111 #D91111 #D91111");
	}
	if((length<6||length>14)&&length>0){
		codeEmail = false;
		$("#TANGRAM__4__passwordError").html("请输入6~14个字符");
		$("#TANGRAM__4__password").css("border-color","#DB1111 #D91111 #D91111");
	}
	if(length>=6&&length<=14){
		var c = password.charAt(0);
		for(var i=1;i<length;i++){
			if(password.charAt(i)!=c) break;
		}
		if(i==length) {
			codeEmail = false;
			$("#TANGRAM__4__passwordError").html("你的密码过于简单");
			$("#TANGRAM__4__password").css("border-color","#DB1111 #D91111 #D91111");
		}else{
			codeEmail = true;
			$("#TANGRAM__4__passwordError").html("");
			$("#TANGRAM__4__password").css("border-color","#CCCCCC #DDDDDD #DDDDDD #CCCCCC");
			$("#TANGRAM__4__passwordSucc").css("display","block");
		}
	}
	
}
function checkVerifyCode(verifyCode){
	length = verifyCode.length;
	if(length==0){
		codeEmail = false;
		$("#TANGRAM__4__verifyCodeError").html("请填写验证码");
		$("#TANGRAM__4__verifyCode").css("border-color","#DB1111 #D91111 #D91111");
	}else{
		codeEmail = true;
		$("#TANGRAM__4__verifyCodeError").html("");
		$("#TANGRAM__4__verifyCode").css("border-color","#CCCCCC #DDDDDD #DDDDDD #CCCCCC");
	}
}